<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
  <style>
    #footer_center h3{color: white}
    #footer_center p{margin: 0}
  </style>
</head>
<body>
<div id="app">
  <el-container>
    <my-header></my-header>
    <el-main style="width: 1200px;margin: 0 auto">
        <el-row gutter="20">
          <el-col span="12">
            <el-card>
              <img src="imgs/reg.png" width="100%">
            </el-card>
          </el-col>
          <el-col span="12">
            <el-form style="margin-top: 50px" label-width="80px">
              <el-form-item>
                <h1 style="font-size: 30px">立即注册
                  <span style="float: right;font-size: 15px">
                    <a href="" style="color: #0aa1ed;text-decoration: none">已有账号?现在登录</a>
                  </span>
                </h1>
              </el-form-item>
              <el-form-item label="用户名"><el-input v-model="user.username" placeholder="请输入用户名"></el-input></el-form-item>
              <el-form-item label="密码"><el-input v-model="user.password" placeholder="请输入密码"></el-input></el-form-item>
              <el-form-item label="昵称"><el-input v-model="user.nickname" placeholder="请输入昵称"></el-input></el-form-item>
              <el-form-item><el-button type="primary" @click="reg()">注册</el-button></el-form-item>
            </el-form>
          </el-col>
        </el-row>
    </el-main>
    <el-footer style="background-color: #2f3234;height: 280px;padding: 50px 0">
        <div style="width: 1200px;margin: 0 auto;text-align: center;color: #666">
          <el-row gutter="20">
            <el-col span="8">
              <img src="imgs/icon.png">
              <p>教程灵感就看烘焙坊</p>
              <p>烘焙行业网络社区平台</p>
              <p>全国百城上千个职位等你来</p>
            </el-col>
            <el-col id="footer_center" span="8">
              <el-row gutter="20">
                <el-col span="8">
                  <h3>关于我们</h3>
                  <p>烘焙学院</p><p>烘焙食谱</p>
                  <p>分类信息</p><p>求职招聘</p><p>社区交流</p>
                </el-col>
                <el-col span="8">
                  <h3>服务与支持</h3>
                  <p>练习我们</p><p>广告投放</p>
                  <p>用户协议</p><p>友情链接</p><p>在线反馈</p>
                  <p>我发投稿</p>
                </el-col>
                <el-col span="8">
                  <h3>底部导航</h3>
                  <p>Archiver</p><p>手机版</p><p>小黑屋</p>
                </el-col>
              </el-row>
            </el-col>
            <el-col span="8">
              <p style="font-size: 60px;margin: 0">
                <span style="color: orange">烘焙</span>坊
              </p>
              <p>烘焙行业网络社区平台</p>
            </el-col>
          </el-row>
        </div>
    </el-footer>
  </el-container>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<!--引入Axios框架-->
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
<script src="js/header.js"></script>
<script>
  let v = new Vue({
    el: '#app',
    data: function() {
      return {
        user:{username:"",password:"",nickname:""}
      }
    },
    methods:{
      reg(){
        //发出注册请求
        axios.post("/v1/users/reg",v.user).then(function (response) {
          if (response.data.code==1){
            location.href="/login.html";
          }else{
            v.$message.error(response.data.msg);
          }
        })
      }
    }
  })
</script>
</html>